cmake_minimum_required(VERSION 3.10.0)
project(SpaceFighter VERSION 0.1.0 LANGUAGES C CXX)

# 设置C++标准

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# 设置编译选项
if (MSVC)
    add_compile_options(/W4)
else()
    add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# 设置编译输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_SOURCE_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_SOURCE_DIR})

set(TARGET ${PROJECT_NAME}-${PROJECT_VERSION})

# 查找并载入CMake预设
list(APPEND CMAKE_PREFIX_PATH "D:/SDL2-2.30.10/")
list(APPEND CMAKE_PREFIX_PATH "D:/SDL2_image-2.8.8/")
list(APPEND CMAKE_PREFIX_PATH "D:/SDL2_mixer-2.8.1/")
list(APPEND CMAKE_PREFIX_PATH "D:/SDL2_ttf-2.24.0/")
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_mixer REQUIRED)
find_package(SDL2_ttf REQUIRED)

# 添加可执行文件
add_executable(${TARGET} 
                        "src/main.cpp"
                        "src/Game.cpp"
                        "src/SceneMain.cpp")

# 链接库
target_link_libraries(${TARGET} 
                        mingw32 
                        ${SDL2_LIBRARIES}
                        SDL2_image::SDL2_image
                        SDL2_mixer::SDL2_mixer
                        SDL2_ttf::SDL2_ttf)
